import re
import os

input_dir = "E:\\3rd source code\\20140904193251"
apk_str = "PassAccountingOneWeek"
for file_name in os.listdir(input_dir):
    match = re.search(".*ChannelCode=(.*)_unsigned_.*\.apk", file_name)
    if match is not None:
        extract = match.group(1)
        new_file = "" + extract + ".apk"
        os.rename(os.path.join(input_dir,file_name),os.path.join(input_dir,new_file))

        
    
